<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "app",
  components: {},
  mounted() {
    this.getUserInfo();
    this.getCartCount();
  },

  methods: {
    getUserInfo() {
      this.axios.get("/user").then((res = {}) => {
        this.$store.dispatch("saveUserName", res.username);
      });
    },
    getCartCount() {
      this.axios.get("/carts/products/sum").then((res = 0) => {
        this.$store.dispatch("saveCartCount", res);
      });
    },
  },
};
</script>

<style lang="scss">
@import "@/assets/scss/reset.scss";
@import "@/assets/scss/mixin.scss";
@import "@/assets/scss/config.scss";
@import "@/assets/scss/modal.scss";
</style>
